<%@page import="vo.Cart"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	function checkQty(name, qty){
		if(qty !=1){
			location.href="itemCartQtyDown.do?name="+name;
		}else{
			return;
		}
	}
</script>
</head>

<body>
<%
	ArrayList<Cart> cartList = (ArrayList<Cart>)request.getAttribute("cartList");
	int sumMoney=(Integer)request.getAttribute("sumMoney");
%>
<h1 align="center"><font color="black" size="15">장바구니</font></h1>
<table width="600" align="center">
<tr>
<td align="right"><a href="itemList.do">쇼핑 계속하기</a></td>
</tr>
</table>
<%
if(cartList.size()==0){
%>
<h1 align="center">상품이 존재하지 않습니다.</h1>
<%
}else{
%>
<form action="itemCartRemove.do" method="post" name="removeFrm">
<table align="center" width="600" border="1">
	<tr align="center" bgcolor="orange">
		<td>번호</td>
		<td>상품이미지</td>
		<td>상품명</td>
		<td>상품가격</td>
		<td>수량</td>
		<td align="center">
			<input type="submit" value="삭제" name="delete">
		</td>
	</tr>
<%
int num=1;
for(int i=0; i<cartList.size(); i++){
%>
<tr align="center">
	<td><%= num++ %></td>
	<td><img src="<%=cartList.get(i).getImage() %>" width="70" height="70"></td>
	<td><%=cartList.get(i).getName() %></td>
	<td><%=cartList.get(i).getPrice() %></td>
	<td>
		<a href="itemCartQtyUp.do?name=<%= cartList.get(i).getName() %>">
		<img alt="" src="img/up.jpg" width="15" height="15" border="0">
		</a>
		<br>
		<%= cartList.get(i).getQuantity() %><br>
		<a href="javascript:checkQty('<%= cartList.get(i).getName() %>',<%= cartList.get(i).getQuantity()%>)">
		<img alt="" src="img/down.jpg" width="15" height="15" border="0">
		</a>
		<br>		
	</td>
	<td align="center">
		<input type="checkbox" name="delete" value="<%=cartList.get(i).getName() %>">
	</td>
</tr>
<%
}
%>
</table>
</form>
<table align="center" width="600" border="0">
	<tr align="center" bgcolor="orange">
	   <td align="right" colspan="6"><font color="gray" size="5">총 결제금액 : </font>
	   <font color="black" size="8"><%= sumMoney %>  </font></td>
	</tr>
</table>
<%
}
%>
</body>
</html>














